package com.task2112.task3;

import java.util.Scanner;

/*
 *TODO:任务三：打印中国结图案关键算法
 *ClassName:Task3
 *UserName:wsyaotao
 *CreateTime:2020/9/15 11:18
 */
public class Task3 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入整数:");
        int num = sc.nextInt();
        for (int i = 0; i < num; i++) {
            //打印空格
            for (int j = 0; j < num - i; j++) {
                System.out.print(" ");
            }
            //打印*
            for (int j = 0; j < 2 * i - 1; j++) {
                System.out.print("*");
            }
            //换行
            System.out.println();
        }
        for (int i = num; i > 0; i--) {
            //打印空格
            for (int j = num; j > i; j--) {
                System.out.print(" ");
            }
            //打印*
            for (int j = 2 * i - 1; j > 0; j--) {
                System.out.print("*");
            }
            //换行
            System.out.println();
        }
    }
}
